<div class="card">
    <div class="card-block">
        <a href="javascript:;" onclick="_goto('?m=members&a=role_edit')"><button type="button" class="btn btn-primary"><span class="glyphicon glyphicon-plus"></span>  添加角色</button></a>
    </div>
    <div class="card-block">
        <table class="table table-striped table-hover table-sm" style="word-break:break-all; word-wrap:break-word;">
            <thead>
            <tr>
                <th>ID</th>
                <th>角色名称</th>
                <td>角色介绍</td>
                <td>更新时间</td>
                <td>操作</td>
            </tr>
            </thead>
            <tbody>
            {#list
            <tr class="odd gradeX">
            <td>{id}</td>
            <td>{name}</td>
            <td>{content}</td>
            <td>{updatetime}</td>
            <td>
            <a href="#" onClick="table_data_edit({id})">编辑</a>
            <a href="#" onclick="table_data_delete({id})">删除</a></td>
            </tr>
            #}
            </tbody>
        </table>
        <p>{pagenav}</p>
    </div>
</div>

<script type="text/javascript">

    function table_data_edit(id){
        _goto("?m=members&a=role_edit&page={current_page}&id=" + id);
    }

    function table_data_delete(id) {
        if(confirm("确定要删除此角色吗？")) {
            $.ajax({
                url: "?m=members&a=role_delete&page={current_page}",
                type: "POST",
                data: "id=" + id,
                dataType: "json",
                error: function(xhr,textStatus){
                    alert(textStatus);
                },
                success: function (data,textStatus,jqXHR) {
                    if(data.status == "error") {
                        alert(data.msg);
                        return;
                    } else {
                        _refresh_page();
                    }
                }
            });
        }
    }

</script>